package com.handinfo.android.download;

import java.io.File;

import com.handinfo.android.DWGameManager;
import com.handinfo.android.utils.Tools;

//import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.text.Html.TagHandler;
import android.util.Log;
import android.widget.Toast;

public class DownloadCompleteReceiver extends BroadcastReceiver
{
	@Override
	public void onReceive(Context context, Intent intent)
	{
//        if(intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE)){  
//            long downId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
//            Tools.debugPrintln("接受到的下载包id ： " + downId);
////            Toast.makeText(context, intent.getAction() + "id : " + downId, Toast.LENGTH_SHORT).show();  
//            
//            DWDownloadManager dlm = DWGameManager.getInstance().getDownloadManager();
//            if (dlm == null)
//            	return;
//            if (downId != dlm.getDownloadId())
//            	return;
//            DWGameManager.getInstance().setRunning(false);
//            if (DWGameManager.getInstance().getGameHandler() != null) {
//            	DWGameManager.getInstance().getGameHandler().setRunning(false);
//            }
//            
//            Intent intent2 = new Intent(Intent.ACTION_VIEW);
//            
//            intent2.setDataAndType(
//                    Uri.fromFile(new File(DWDownloadManager.s_savefold, DWDownloadManager.APK_NAME)),
//                    "application/vnd.android.package-archive");
//            DWGameManager.getInstance().getCurrentActivity().startActivity(intent2);
//        }  
	}
}
